//pthread_exit函数
#include<my_head.h>
void *task_func(void *arg){
    printf("我是子线程 [%ld] 10秒后退出\n",pthread_self());
    sleep(10);
    printf("我是子线程 [%ld] 退出\n",pthread_self());
    pthread_exit(NULL);
}

int main(int argc, char const *argv[])
{
    pthread_t tid = 0;
    int ret = 0;
    if(0 != (ret = pthread_create(&tid,NULL,task_func,NULL))){
        printf("pthread_create error [%d] [%s]\n",ret,strerror(ret));
        exit(EXIT_FAILURE);
    }
    #if 0
    while(1){
        printf("我是主线程 [%ld]\n",pthread_self());
        sleep(1);
    }
    #else
    printf("我是主线程 [%ld]\n",pthread_self());
    sleep(5);
    pthread_exit(NULL);
    #endif
    return 0;
}
